<template>
  <el-dialog title="编辑教室" :visible.sync="dialogVisible" width="1000px" :close-on-click-modal="false"
    :modal-append-to-body="false" v-drag2anywhere>
    <el-form :data="formData" ref="formData" label-width="85px" size="mini" :rules="rules">
       <el-row :gutter="30">
         <el-col :span="12">
           <el-form-item label="教师名称" prop="title">
             <el-input v-model="formData.title" placeholder="教室名称"></el-input>
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="容纳人数:" prop="capacity">
             <el-input-number v-model="formData.capacity" placeholder="容纳人数" :min="1" ></el-input-number>
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="所属校区" prop="area">
             <el-select v-model="formData.area" placeholder="所属校区" clearable filterable>
               <el-option label="尚武拉丁(县医院)" value="尚武拉丁(县医院)"></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="启用状态" prop="status">
             <el-switch v-model="formData.status" placeholder="位置" active-value="1"></el-switch>
           </el-form-item>
         </el-col>
         <el-col >
           <el-form-item label="教室说明:" prop="desc">
             <el-input type="textarea" v-model="formData.desc" placeholder="教室说明" :rows="5" maxlength="500" show-word-limit></el-input>
           </el-form-item>
         </el-col>
       </el-row>
     </el-form>
    <div slot="footer">
      <el-button @click="dialogVisible=false">取消</el-button>
       <el-button type="primary" @click="handleSave">保存</el-button>
    </div>
  </el-dialog>
</template>

<script>
  export default{
    data(){
      return {
        index:-1,
        formData:{
          title:'',
          desc:'',
          status:'1',
          capacity:30,
        },
        dialogVisible:false,
        rules:{
          title:[{required:true,message:"请正确填写教室名称",trigger:'blur'}],
          capacity:[{required:true,message:"请正确选择教室启用状态",trigger:'change'}]
        }
      }
    },
    methods:{
      initData(index,data){
          this.index=index;
          this.formData=data;
          this.formData.status=""+this.formData.status;
      },
      handleSave(){

      }
    }
  }
</script>

<style>
</style>
